﻿@using _1_31_2015_SLMSite.Models
@model UsersListsViewModel
@{
    ViewBag.Title = "Index";
}

@if (Model.Admins.Count > 0)
{
    <div class="col-md-12 column">
        <h2>Admins</h2>
        <div class="box-body ">
            <table class="table table-striped table-bordered" id="techUsersTable">
                <thead>
                    <tr>
                        <th>Name</th>
                        <th>Email</th>
                        <th>Username</th>
                        <th>Operations</th>

                    </tr>
                </thead>
                <tbody>
                    @foreach (var u in Model.Admins)
                    {
                        <tr>
                            <td>@(u.FirstName + " " + u.LastName)</td>
                            <td>@u.Email</td>
                            <td>@u.DisplayName</td>
                            <td>
                                @(Html.ActionLink("View Tickets", "Technician", new { userId = u.UserId }, new { @class = "btn btn-info btn-xs " }))
                                @(Html.ActionLink("Delete Admin", "Delete", new { userId = u.UserId }, new { @class = "btn btn-danger btn-xs " }))
                                @(Html.ActionLink("Edit Admin", "AddUpdate", new { userId = u.UserId }, new { @class = "btn btn-primary btn-xs " }))
                            </td>
                        </tr>

                    }
                </tbody>

            </table>
        </div>
    </div>
}
@if (Model.Clients.Count > 0)
{
    <div class="col-md-12 column">
        <h2>Clients</h2>
        <div class="box-body">
            <table class="table table-striped table-bordered" id="adminUsersTable">
                <thead>
                    <tr>
                        <th>Name</th>
                        <th>Email</th>
                        <th>Username</th>
                        <th>Operations</th>

                    </tr>
                </thead>
                <tbody>
                    @foreach (var u in Model.Clients)
                    {
                        <tr>
                            <td>@(u.FirstName + " " + u.LastName)</td>
                            <td>@u.Email</td>
                            <td>@u.DisplayName</td>



                            <td>
                                @(Html.ActionLink("View Tickets", "Technician", new { userId = u.UserId }, new { @class = "btn btn-info btn-xs " }))
                                @(Html.ActionLink("Delete Client", "Delete", new { userId = u.UserId }, new { @class = "btn btn-danger btn-xs " }))
                                @(Html.ActionLink("Edit Client", "AddUpdate", new { userId = u.UserId }, new { @class = "btn btn-primary btn-xs " }))
                            </td>

                        </tr>

                    }
                </tbody>
            </table>
        </div>
    </div>
}
@if (Model.Generals.Count > 0)
{
    <div class="col-md-12 column">
        <h2>General Users</h2>
        <div class="box-body ">
            <table class="table table-bordered table-striped dataTable" id="usersTable">
                <thead>
                    <tr>
                        <th>Name</th>
                        <th>Email</th>
                        <th>Username</th>
                        <th>Operations</th>

                    </tr>
                </thead>
                <tbody>
                    @foreach (var u in Model.Generals)
                    {
                        <tr>
                            <td>@(u.FirstName + " " + u.LastName)</td>
                            <td>@u.Email</td>
                            <td>@u.DisplayName</td>
                            <td>
                                @(Html.ActionLink("View Tickets", "Technician", new { userId = u.UserId }, new { @class = "btn btn-info btn-xs " }))
                                @(Html.ActionLink("Delete User", "Delete", new { userId = u.UserId }, new { @class = "btn btn-danger btn-xs " }))
                                @(Html.ActionLink("Edit User", "AddUpdate", new { userId = u.UserId }, new { @class = "btn btn-primary btn-xs " }))
                            </td>
                        </tr>

                    }
                </tbody>
            </table>
        </div>
    </div>
}
<div class="col-md-12 column">
    @(Html.ActionLink("Add User", "AddUpdate", null, new { @class = "btn btn-info" }))
</div>





@section Scripts {

    <script>

            $(function () {


                $('#usersTable').dataTable();
                $('#adminUsersTable').dataTable();
                $('#techUsersTable').dataTable();
            });


    </script>>
}
